//
//  DCBaseViewController.m
//  Demo
//
//  Created by Kyle on 2022/12/29.
//

#import "DCBaseViewController.h"
#import "DCNavgiteBar.h"

@interface DCBaseViewController ()<DCNavgiteBarDelegate>


@end

@implementation DCBaseViewController

- (void)viewDidLoad {
    [self configureAlloc];
    [self configureUI];
    [super viewDidLoad];
}


- (void)configureUI {
    self.fd_prefersNavigationBarHidden = YES;
    self.view.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    _navgitBar = [[DCNavgiteBar alloc] initWithFrame:CGRectZero];
    _navgitBar.delegate = self;
    _navgitBar.hidden = NO;
    [self.view addSubview:_navgitBar];
    [_navgitBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(0);
        make.height.mas_equalTo(88);
    }];
    [self updateNavrStyle:DCNavgiteBarStyleBlack];    
}

- (void)configureAlloc {
    
}

- (void)setTitleName:(NSString *)titleName {
    [_navgitBar updateTitleName:titleName];
}

- (void)updateNavrStyle:(DCNavgiteBarStyle)barStyle {
    [_navgitBar upDateBarStyle:barStyle];
}

- (void)leftBackAction:(UIButton *)sender {
    [self backAction:sender];
}

- (void)backAction:(UIButton *)sender {
    if (self.navigationController) {
        [self.navigationController popViewControllerAnimated:YES];
    } else {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}

- (UIStatusBarStyle)preferredStatusBarStyle {
//    return UIStatusBarStyleLightContent;
    if (@available(iOS 13.0, *)) {
        return UIStatusBarStyleDarkContent;
    } else {
        // Fallback on earlier versions
        return UIStatusBarStyleDefault;
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
